<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta content="width=device-width, initial-scale=1.0" name="viewport" />
		<link rel="shortcut icon" href="image/favicon.ico" />
		<title>----</title>
	</head>

	<body>
		<div id="header"></div>
		<div style="margin: -5px 5px 5px 5px;">
			<div id="structure"></div>
		</div>
		<div id="footer"></div>

		<script src="js/loading.js"></script>
		<script src="lib/requirejs/require.min.js"></script>
		<script src="js/vw.config.require.js"></script>
		<script>
			require(['vw.header', 'vw.map'], function(vw_header) {
				vw_header.init("header", "footer");

				var scales = [8, 10, 12, 14, 16, 18];
				var curZoomLevel = 0;
				var curLevel = 0;
				var curCode, upCode;

				$('#structure').vw_map({
					height: $(window).height() - 45,
					defaultMapview: VW_INTERFACE.DEFAULT_MAP_VIEW,
					onInitialized: function() {
						//						upCode = "";
						draw("510000", false);
					},
					onClickMarker: function(code) {
						//						upCode = curCode;
						draw(code, true);
					},
					OnZoom: function(e) {
						if(curZoomLevel > e.target._zoom) {
							curLevel = 1;
							draw("510000", false);
						}
						curZoomLevel = e.target._zoom;
					}
				});

				function draw(code, zoom) {
					vw_common.customAjax({
						url: VW_INTERFACE.WEBSERVICE.ObjectManage('GetObject'),
						type: "GET",
						dataType: "json",
						data: {
							"catalogID": code
						}
					}, function(e) {
						$('#structure').vw_map('refresh').vw_map("drawPolygon", e.data, !zoom);
						//						curCode = code;
						if(curLevel == 5) {
							vw_common.customAjax({
								url: VW_INTERFACE.WEBSERVICE.ObjectManage('GetNatureLand'),
								type: "GET",
								dataType: "json",
								data: {
									"code": code
								}
							}, function(e) {
								$('#structure').vw_map("drawPolygon", e.data, true, {
									color: "#FFFACD",
									weight: 1
								});
							});
						} else {
							vw_common.customAjax({
								url: VW_INTERFACE.WEBSERVICE.ObjectManage('GetNextObject'),
								type: "GET",
								dataType: "json",
								data: {
									"code": code
								}
							}, function(e) {
								$('#structure').vw_map("drawPolygon", e.data, zoom, {
									color: "#FFFACD",
									weight: 2
								});
								curLevel = e.level;
							});
						}
					});
				}
			});
		</script>
	</body>

</html>